package com.example.mymvplibrary.adapter;

import android.content.Context;
import android.view.ViewGroup;

import java.util.List;


public abstract class MulitipleAdpter<DATA> extends BaseAdapter<DATA>{
    private CommType<DATA> commType;
    protected int type=-1;
    public MulitipleAdpter(List<DATA> datas, Context context,CommType commType) {
        super(datas, context, 0);
        this.commType=commType;
    }

    @Override
    public int getItemViewType(int position) {
        type=commType.getType(position,datas.get(position));
         return type;
    }

    @Override
    public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        int typeLayout = commType.getTypeLayout(viewType);
        return new BaseViewHolder(layoutInflater.inflate(typeLayout,parent,false));
    }
}
